<!DOCTYPE html>
<html lang="zh-CN">
  <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
	  <#include "/common/plateform/include/common-base.ftl">
  <title>管理员审核</title>
  <!-- Tell the browser to be responsive to screen width -->
</head>

<!-- Part 一、 以下是body主体内容的模块区域 -->
<body class="hold-transition ${sysColor} sidebar-mini">
<div class="wrapper">

	<!-- top start -->
	<#include "/common/plateform/top.ftl">
	<!-- top end -->
	<!-- left start -->
	<#include "left-account.ftl">
	<!-- left end-->

  <div class="content-wrapper">
    <!-- Main start -->
	<section class="content">
	  			<div id="div_hidden_content" class="hidden" style="display:none;">
			  					<div id="hidden_common_final">
									<!-- temp="hidden_common_final" start -->
										<input name="mainObjName" type="hidden" value="uctUser">
										<input name="mainObjPrimaryKey" type="hidden" value="userId">
										<input name="objNameAll" type="hidden" value="uctUser">
				<!-- temp="hidden_common_final" end -->
								 </div>
			 					<!-- temp="delForm_hidden" start -->
									<div id="delForm_hidden">
									</div>
								<!-- temp="delForm_hidden" end -->
	  			</div>
      <div class="row">
        <div class="col-xs-12">
        
          <!------搜索  start ------->
          <div class="box box-info">
             <!--搜索title  start --> 
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-search"></i> 管理员审核搜索</h3>
                 <div class="box-tools pull-right">
    				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
 				 </div>
              </div>
            <!--搜索title  end --> 
            <div class="box-body">
            	<form id="searchForm" action="javascript:;">
	            	<!-- temp="searchForm_hidden" start -->
	            	<div id="searchForm_hidden">
						<input type="hidden" name="pageName" value="user-list"/>
						<input type="hidden" name="formName" value="searchForm-new"/>
						<input type="hidden" name="uctUser.w_userType" value="manager"/>
						<input type="hidden" name="uctUser.w_auditStatus" value="10"/>
						<input type="hidden" name="orderBy" value="uctUser.create_time desc"/>
					</div>
					<!-- temp="searchForm_hidden" end -->
	              	<!-- temp="searchForm_content" start -->
				<div id="searchForm_content" class="form-group"  data-temp-code="true" data-temp-type="searchForm" data-temp-form-id="searchForm">

					<table class="table table-bordered bordercolor">
						<tbody>
						<tr>
							<td class="active" align="right"><label class="form-control-static">登录账号：</label></td>
							<td>
								<div class="form-group"><input name="uctUser.wl_userEname" class="form-control clean"
															   maxlength="30" data-temp-obj="uctUser.userEname"></div>
							</td>
							<td class="active" align="right"><label class="form-control-static">用户名称：</label></td>
							<td>
								<div class="form-group"><input name="uctUser.wl_userCname" class="form-control clean"
															   maxlength="30" data-temp-obj="uctUser.userCname"></div>
							</td>
						</tr>
						</tbody>
					</table>
				</div>
				<!-- temp="searchForm_content" end -->
			  	</form>
			  <div class="box-footer text-center">
			       <button type="button" class="btn btn-success" onclick="getTableData();" data-temp-event="searchForm_hidden"><i class="fa fa-search"></i> 查询</button> 
			       <button type="button" class="btn btn-warning" onclick="mytools.cleanData('#searchForm');">重置 </button>
			   </div>
            </div>
	     </div>
	     <!------- 搜索 end -------->
           
        <!------- 列表 start -------->
          <div class="box box-success">
            <!--列表title  start --> 
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-table"></i> 查询结果
                 </h3>
                 <div class="box-tools pull-right">
    				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
 				 </div>
              </div>
			  <div class="box-body">
              	 	<table id="dataList" class="table table-bordered table-hover">
              	 		<thead>
		                	<tr id="dataList_thead_content" data-temp-code="true" data-temp-type="table" data-temp-show="dataList_template_content">
			                	<th>序号</th>
			                	<!-- temp="dataList_thead_content" start -->

											<th data-temp-obj="uctUser.userEname">用户账号</th>
											<th data-temp-obj="uctUser.userCname">用户名称</th>
											<th data-temp-obj="uctUser.customerType">主体类型</th>
											<th data-temp-obj="uctUser.mobile">手机</th>
											<th data-temp-obj="uctUser.email">用户类别</th>
											<th data-temp-obj="uctUser.createTime">创建时间</th>
											<th>操作</th>
				<!-- temp="dataList_thead_content" end -->
		                	</tr>
	                	</thead>
		                <tbody id="dataList-body">
		                	
		                </tbody>
	              </table>
            	</div>
           	 	
           	 	<div class="box-footer text-center">
			      	<ul id="dataList-page" class="pagination">
					</ul>
			 	</div>              
           </div>
        <!------- 列表 end -------->
        </div>
      </div>
  

<div win-title="审核窗口" class="modal fade" id="my_modal_audit_person" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width:80%;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">管理员信息审核-个人</font> 
						</h4>
					</div>
					<div class="modal-body viewForm">
						
						<div class="nav-tabs-custom">
					            <ul class="nav nav-tabs">
					            </ul>
					            
					            <!-- tab content start -->
					            <div class="tab-content">
					            
					               <div class="tab-pane active">
					                  <form class="form-horizontal" role="form" id="auditForm_person" action="javascript:void(0)">
										  <div id="auditForm_person_hidden" style="display:none;">
											  <input type="hidden" name="pageName" value="org-user-audit"/>
											  <input type="hidden" name="formName" value="auditForm-p"/>
											  <input type="hidden" name="uctUser.w_userId" data-name="uctUser.userId" class="clean"/>
											  <input type="hidden" name="uctUser.auditStatus" value="91"/>
											  <input type="hidden" name="uctOrg.orgId" value=""/>
										  </div>
					              		<!-- temp="auditForm_person_content" start -->
												<div id="auditForm_person_content" class="row auditForm">

													<table class="table table-bordered bordercolor">
														<tbody>
														<tr>
															<td rowspan="2" class="active" style="width:30px;padding: 0px 10px;">
																<label class="form-control-static">账号信息</label>
															</td>
															<td class="active" align="right"><label class="form-control-static">用户账号：</label></td>
															<td class="w280">
																<div class="form-control-static"><span data-name="uctUser.userEname"></span></div>
															</td>
															<td class="active" align="right"><label class="form-control-static">手机：</label></td>
															<td>
																<div class="form-control-static"><span data-name="uctUser.mobile"></span></div>
															</td>
														</tr>
														<tr>
															<td class="active" align="right"><label class="form-control-static">用户状态：</label></td>
															<td colspan="3">
																<div class="form-control-static">启用</div>
															</td>
														</tr>
														<tr>
															<td rowspan="3" class="active" style="width:30px;padding: 0px 10px;vertical-align: middle;">
																<label class="form-control-static">登记信息</label>
															</td>
															<td class="active" align="right"><label class="form-control-static">主体类型：</label></td>
															<td>
																<div class="form-control-static">个人</div>
															</td>
															<td class="active" align="right"><label class="form-control-static">个人名称：</label></td>
															<td>
																<div class="form-control-static"><span data-name="uctUser.userCname"></span></div>
															</td>
														</tr>
														<tr>
															<td class="active" align="right"><label class="form-control-static">证件类型：</label></td>
															<td>
																<div class="form-control-static">身份证</div>
															</td>
															<td class="active" align="right"><label class="form-control-static">证件号码：</label></td>
															<td>
																<div class="form-control-static"><span data-name="uctUser.certNo"></span></div>
															</td>
														</tr>
														<tr>
															<td class="active" align="right"><label class="form-control-static">邮箱：</label></td>
															<td>
																<div class="form-control-static"><span data-name="uctUser.email"></span></div>
															</td>
															<td class="active" align="right"><label class="form-control-static">申请状态：</label></td>
															<td>
																<div class="form-control-static">待审核</div>
															</td>
														</tr>
														</tbody>
													</table>

												</div>
				<!-- temp="auditForm_person_content" end -->
					                    
					                  </form>
					                  <div class="form-group">
                                        <div class="col-sm-12">
                                         <div class="box-footer text-center">
                                            <button class="btn btn-success" type="button" onclick="updataUserAuditStatus('#auditForm_person',91);"> 审核通过 </button>
											 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											 <button class="btn btn-danger" type="button" onclick="updataUserAuditStatus('#auditForm_person',90);"> 审核不通过 </button>
                                        </div>
                                        </div>
                                      </div>
					               </div>
					               
					          
				            </div>
					            <!-- tab content e -->
				          </div>
					</div>
				</div>
				<!-- /.modal-content -->
	</div>		
</div>

<div win-title="审核窗口" class="modal fade" id="my_modal_audit_org" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width:80%;">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					×
				</button>
				<h4 class="modal-title">
					<font color="red">管理员信息审核-企业</font> 
				</h4>
			</div>
			<div class="modal-body viewForm">

				<div class="nav-tabs-custom">
					<ul class="nav nav-tabs">
					</ul>

					<!-- tab content start -->
					<div class="tab-content">

						<div class="tab-pane active">
							<form class="form-horizontal" role="form" id="auditForm_org" action="javascript:void(0)">
								<div id="auditForm1_hidden" style="display:none;">
									<input type="hidden" name="pageName" value="org-user-audit"/>
									<input type="hidden" name="formName" value="auditForm-o"/>
									<input type="hidden" name="uctUser.w_userId" data-name="uctUser.userId" class="clean"/>
									<input type="hidden" name="uctUser.auditStatus" value="91"/>
									<input type="hidden" name="uctOrg.orgStatus" value="1"/>
									<input type="hidden" name="uctOrg.fatherId" value="0"/>
									<input type="hidden" name="uctOrg.treeLevel" value="1"/>
								</div>
								<!-- temp="auditForm_org_content" start -->
								<div id="auditForm_org_content" class="row auditForm">

									<table class="table table-bordered bordercolor">
										<tbody>
										<tr>
											<td rowspan="2" class="active" style="width:30px;padding: 0px 10px;">
												<label class="form-control-static">账号信息</label>
											</td>
											<td class="active" align="right"><label class="form-control-static">用户账号：</label></td>
											<td class="w280">
												<div class="form-control-static"><span data-name="uctUser.userEname"></span></div>
											</td>
											<td class="active" align="right"><label class="form-control-static">手机：</label></td>
											<td>
												<div class="form-control-static"><span data-name="uctUser.mobile"></span></div>
											</td>
										</tr>
										<tr>
											<td class="active" align="right"><label class="form-control-static">用户状态：</label></td>
											<td colspan="3">
												<div class="form-control-static">启用</div>
											</td>
										</tr>
										<tr>
											<td rowspan="3" class="active" style="width:30px;padding: 0px 10px;vertical-align: middle;">
												<label class="form-control-static">登记信息</label>
											</td>
											<td class="active" align="right"><label class="form-control-static">主体类型：</label></td>
											<td>
												<div class="form-control-static">企业</div>
											</td>
											<td class="active" align="right"><label class="form-control-static">企业名称：</label></td>
											<td>
												<div class="form-control-static"><span data-name="uctUser.userCname"></span></div>
											</td>
										</tr>
										<tr>
											<td class="active" align="right"><label class="form-control-static">证件类型：</label></td>
											<td>
												<div class="form-control-static">营业执照/统一社会信用证</div>
											</td>
											<td class="active" align="right"><label class="form-control-static">证件号码：</label></td>
											<td>
												<div class="form-control-static"><span data-name="uctUser.certNo"></span></div>
											</td>
										</tr>
										<tr>
											<td class="active" align="right"><label class="form-control-static">邮箱：</label></td>
											<td>
												<div class="form-control-static"><span data-name="uctUser.email"></span></div>
											</td>
											<td class="active" align="right"><label class="form-control-static">申请状态：</label></td>
											<td>
												<div class="form-control-static">待审核</div>
											</td>
										</tr>
										<tr>
											<td rowspan="3" class="active" style="width:30px;padding: 0px 10px;">
												<label class="form-control-static">机构信息</label>
											</td>
											<td class="active" align="right"><label class="form-control-static">机构标识：</label></td>
											<td>
												<div class="form-group">
													<input type="text" class="form-control clean" name="uctOrg.orgEname" data-name="uctUser.userEname"  placeholder="请输入机构标示" data-bv-notempty="true" data-bv-notempty-message="必填项，请输入机构标示" data-bv-regexp="true" data-bv-regexp-regexp="^[a-zA-Z0-9_]*$" data-bv-regexp-message="必须有字母、数字、下划线组成"/>
												</div>
											</td>
											<td class="active" align="right"><label class="form-control-static">机构代码：</label></td>
											<td>
												<div class="form-group">
													<input type="text" class="form-control clean" name="uctOrg.orgCode" data-name="uctUser.userEname"  placeholder="请输入机构代码" data-bv-notempty="true" data-bv-notempty-message="必填项，请输入机构代码" data-bv-regexp="true" data-bv-regexp-regexp="^[a-zA-Z0-9_]*$" data-bv-regexp-message="必须有字母、数字、下划线组成"/>
												</div>
											</td>
										</tr>
										<tr>
											<td class="active" align="right"><label class="form-control-static">机构名称：</label></td>
											<td>
												<div class="form-group">
													<input type="text" class="form-control clean" name="uctOrg.orgCname" data-name="uctUser.userCname"  placeholder="请输入机构名称" data-bv-notempty="true" data-bv-notempty-message="必填项，请输入机构名称"/>
												</div>
											</td>
											<td class="active" align="right"><label class="form-control-static">联系人：</label></td>
											<td>
												<div class="form-group">
													<input type="text" class="form-control clean" name="uctOrg.linkMan"  placeholder="请输入机构联系人" data-bv-notempty="true" data-bv-notempty-message="必填项，请输入机构联系人"/>
												</div>
											</td>
										</tr>
										</tbody>
									</table>

								</div>
								<!-- temp="auditForm_org_content" end -->

							</form>
							<div class="form-group">
								<div class="col-sm-12">
									<div class="box-footer text-center">
										<button class="btn btn-success" type="button" onclick="updataUserAuditStatus('#auditForm_org',91);"> 审核通过 </button>
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<button class="btn btn-danger" type="button" onclick="updataUserAuditStatus('#auditForm_org',90);"> 审核不通过 </button>
									</div>
								</div>
							</div>
						</div>


					</div>
					<!-- tab content e -->
				</div>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
</div>


<!-- Part 二、以下是template模板定义的模块区域 -->
<script type="text/template" id="dataList-template">
		<? for ( var i = 0; i < rows.length; i++) {?>
		<tr>
				<td><?=(pageObj.currentPage-1)*10+(i+1)?></td>
				<td><?=strUtil.doNull(rows[i].uctUser.userEname,'')?></td>
				<td><?=strUtil.doNull(rows[i].uctUser.userCname,'')?></td>
				<td>
					<?if(rows[i].uctUser.customerType=='person'){?>个人<?}?>
					<?if(rows[i].uctUser.customerType=='org'){?>企业<?}?>
				</td>
				<td><?=strUtil.doNull(rows[i].uctUser.mobile,'')?></td>
				<td>
					<?if(rows[i].uctUser.delStatus=='0'){?>机构用户<?}?>
					<?if(rows[i].uctUser.delStatus=='1'){?><span class="text-green">平台管理员</span><?}?>
					<?if(rows[i].uctUser.delStatus=='2'){?>机构管理员<?}?>
					<?if(rows[i].uctUser.delStatus=='3'){?>系统管理员<?}?>
				</td>
				<td><?=getFormatDateByLong(rows[i].uctUser.createTime,'yyyy-MM-dd hh:mm:ss')?></td>
              <td>
				<button type="button" class="btn btn-success btn-xs" onclick="showAudit('<?=rows[i].uctUser.customerType?>','<?=rows[i].uctUser.userId?>')"><i class="fa fa-search-plus"></i> 审核</button>  
			</td>
		</tr>
   <?}?>  		
</script>

<!-- Part 三、 以下是js模块区域 -->
<script>
var clickMenu = "org-user-list-audit";
var myPage,dataListId,searchFormId;
myPage = 10;//定义列表数据
dataListId = "dataList";//显示列表数据div的id
searchFormId = "searchForm";//搜索表单Id
/**
 * 初始化数据字典，id传入#id 返回值Map用法：dictListMap["userType"][rows[i].userType]
 */
var dictListMap = DictUtil.initDictAndDymic();
var nowCustomerType = null;
$(function () {
	//1、加载分页列表数据
	getTableData();
	
	//2、控制是否启用token
	//setToken();
 });
 
 $(function () {
	//设置数据行选中效果
	$('#'+dataListId+' tbody').on('click','tr', function (e) {
	     if ( $(this).hasClass('selected') ) {
	        }
	        else {
	            $('tr.selected').removeClass('selected');
	            $(this).addClass('selected');
	        }
	     //var id = $('tr.selected th').eq(0).html();
	} );
 });
//给模态窗口内form表单内的所有支持必填项的元素注入校验
$(".modal").on('shown.bs.modal', function () {
    $(this).find("form").each(function(){
        var formId = $(this).attr("id");
        if(!strUtil.isNull(formId)){
            formId="#"+formId;
            setValidate(formId);//定义add表单验证属性
            mytools.cleanValidate(formId);//清空上次校验规则提示
        }
    });
});

//数据toLoad读取（查看、编辑）数据
function showAudit(customerType,userId){
	var formId="#auditForm_"+customerType;
	mytools.cleanData(formId);//清空表单元素上次填写的内容；
	$("#my_modal_audit_"+customerType).modal("show");

	var paramLoadData = {};
	paramLoadData["pageName"]="user-list";
	paramLoadData["formName"]="searchForm-new";
    paramLoadData["uctUser.w_userId"]=userId;
    $.get(common_info_url, paramLoadData,function(myData){
        console.log(myData);
        //反显加载数据
        if(myData){
            FormUtil.loadView("uctUser", myData.uctUser);
        }
    },"json");
}
//提交审核
function updataUserAuditStatus(formId,status) {
    var statusText = "审核不通过";
	if(91==status){
        statusText = "审核通过";
        //机构保存时验证是否必填项。
        if("#auditForm_org"==formId){
            var validate = $(formId).data('bootstrapValidator').validate();
            if(!validate.isValid()){ //如果校验不通过
                return;
            }
        }
	}
	$(formId).find("input[name='uctUser.auditStatus']").val(status);
    var index_submit = layer.confirm("您确定要["+statusText+"]用户吗？", {btn: ["Yes","No"],closeBtn: 0,offset: "220px"}
	, function(){
            $.ajax({
                type:"post",
                url:common_submit_url,
                data: $(formId).serialize(),dataType:"json",
                success: function(myData){
                    console.log(myData);
                    var result = myData.flag;
                    if(result=="T"){
                        layer.msg(statusText+"操作成功！");
                        $("#my_modal_audit_org").modal("hide");
                        $("#my_modal_audit_person").modal("hide");
                        refresh();
                    }else{
                        layer.alert(statusText+"操作失败！</br>"+myData.msg);
                    }
                }
            });
	})
}
//加载列表数据
function getTableData(){
	$.ajax({
		   type:'get',
		   url:common_list_url,
		   data:$("#"+searchFormId).serialize()+getCurrentPage(common_list_url+"?"+$("#"+searchFormId).serialize(),myPage),
		   dataType:'json',
		   success: function(myData){
		   	console.log(myData);
			    var data = baidu.template(dataListId+"-template",eval(myData));  
				$("#"+dataListId+"-body").html(data);
				  var option= {
						   ele:$("#"+dataListId+"-page")[0],
						   total:myData.total,
						   fn:getTableData,
						   url:common_list_url+"?"+$("#"+searchFormId).serialize()
					   }
					generatePages(option);
			   }
		});	
  }


//刷新
function refresh(){
	getTableData();
}
//设置token
function setToken(){
	$.ajax({
	    type:'get',
	    url:'${ctx}/sendPage/token?token=true',
	    dataType:'text',
	    success: function(myData){
	    	console.log(myData);
			$('.formToken').val(myData);
	  	}
	});	
}
//1.校验规则-定义
function setValidate(formId){
    $(formId).bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        }, /** 以下需要结合实际业务清空补充个表单元素的验证规则 **/
        fields: {

        }
    });
}



</script>
</section>
  <!-- Main end -->
  </div>
	<!-- foot start -->
	<#include "/common/plateform/foot.ftl">
	<!-- foot start -->
</div>
<!-- /.content-wrapper -->

</body>
</html>














